package com.neibu.hw5.demo01;

import com.neibu.hw4.Student;

import java.util.function.Supplier;

/**
 * @author bin
 * @date 2025 - 04 -02
 **/
public class MainTest {
    public static void main(String[] args) {
        Student stu01 = new Student("张三", 18);
        Student stu02 = new Student("李四", 19);
        Student stu03 = new Student("王五", 20);
        Student stu04 = new Student("赵六", 21);
        Student[] students = {stu01, stu02, stu03, stu04};

        Supplier<Student> minStuAge = () -> {
            Student minStu = students[0];
            for (Student student : students) {
                if (student.getAge() < minStu.getAge()) {
                    minStu = student;
                }
             }
            return minStu;
        };
        //拿到返回结果
        System.out.println(minStuAge.get());
    }
}
